{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\myogo\Princeton Dropbox\Motohiro Yogo\Koijen Yogo - International\JPE\Replication\Code\1 Data\Data1.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}31 Oct 2025, 09:17:31
{txt}
{com}. /* Define local and global variables */
> 
> local Nstep = 1e3;
{txt}
{com}. local Mgap = 1e-9;
{txt}
{com}. local tau = .01;
{txt}
{com}.         /* Nelson-Siegel decay factor */
> 
> local matST = .25;
{txt}
{com}.         /* Maturity of ST debt */
> local matLT = 5;
{txt}
{com}.         /* Maturity of LT debt */
> 
> do global;
{txt}
{com}. /* global.do (STATA)
>         Define global variables in "Data".
>         by Ralph Koijen & Motohiro Yogo */
. 
. #delimit ;
{txt}delimiter now ;
{com}. clear all;
{res}{txt}
{com}. global year_min = 2003;
{txt}
{com}. global year_max = 2020;
{txt}
{com}. global small = 5e-4;
{txt}
{com}.         /* Minimum reportable threshold for CPIS */

{txt}end of do-file

{com}. /* Load characteristics data */
> 
> u year country Counterpart counterpart pbv yieldST yieldLT _Gfx _retIR3M _retMS
>         using Data0, clear;
{txt}
{com}. /* Construct zero-coupon yield curve assuming that 
>         yieldST is 3-month zero-coupon yield and yieldLT is 10-year par yield */
> 
> gen beta0 = 0 if !missing(yieldST) & !missing(yieldLT);
{txt}(31 missing values generated)

{com}. gen beta1 = 0 if !missing(yieldST) & !missing(yieldLT);
{txt}(31 missing values generated)

{com}. qui forval i = 1/`Nstep' {c -(};
{txt}
{com}. /* Construct zero-coupon yields */
> 
> forval i = 1/10 {c -(};
{txt}  2{com}.         gen yield`i' = beta0+beta1*(1-exp(-`i'/`tau'))/(`i'/`tau');
{txt}  3{com}.         label var yield`i' "`i'-year zero-coupon yield (continuously compounded)";
{txt}  4{com}. {c )-};
{txt}(31 missing values generated)
(31 missing values generated)
(31 missing values generated)
(31 missing values generated)
(31 missing values generated)
(31 missing values generated)
(31 missing values generated)
(31 missing values generated)
(31 missing values generated)
(31 missing values generated)

{com}. drop yieldLT;
{txt}
{com}. /* Construct future returns */
> 
> sort country year;
{txt}
{com}. forval i = 2/10 {c -(};
{txt}  2{com}.         by country: gen _ret`i' = `i'*yield`i'-`=`i'-1'*yield`=`i'-1'[_n+1];
{txt}  3{com}.         label var _ret`i' "Future: `i'-year zero-coupon return (continuously compounded)";
{txt}  4{com}. {c )-};
{txt}(68 missing values generated)
(68 missing values generated)
(68 missing values generated)
(68 missing values generated)
(68 missing values generated)
(68 missing values generated)
(68 missing values generated)
(68 missing values generated)
(68 missing values generated)

{com}. /* Expand to asset type */
> 
> expand 3;
{txt}(1,416 observations created)

{com}. bysort year country: gen byte type = _n;
{txt}
{com}. /* Construct prices */
> 
> gen maturity = `matST' if type==1;
{txt}(1,416 missing values generated)

{com}. replace maturity = `matLT' if type==2;
{txt}(708 real changes made)

{com}. gen yield = yieldST if type==1;
{txt}(1,447 missing values generated)

{com}. replace yield = yield`matLT' if type==2;
{txt}(677 real changes made)

{com}. gen mb = exp(-maturity*yield) if type<=2;
{txt}(770 missing values generated)

{com}. replace mb = pbv if type==3;
{txt}(640 real changes made)

{com}. drop pbv yieldST;
{txt}
{com}. /* Construct returns */
> 
> gen _ret = _retIR3M+_Gfx if type==1;
{txt}(1,453 missing values generated)

{com}. replace _ret = _ret`matLT'+_Gfx if type==2;
{txt}(640 real changes made)

{com}. replace _ret = _retMS if type==3;
{txt}(671 real changes made)

{com}. drop _Gfx _retIR3M _retMS;
{txt}
{com}. /* Sample criteria */
> 
> keep if inrange(year,$year_min,$year_max);
{txt}(204 observations deleted)

{com}. /* Label variables */
> 
> label var type          "Asset type";
{txt}
{com}. label var beta0         "Nelson-Siegel long-run level";
{txt}
{com}. label var beta1         "Nelson-Siegel short-run component";
{txt}
{com}. label var maturity      "Maturity";
{txt}
{com}. label var yield         "Yield (continuously compounded)";
{txt}
{com}. label var mb            "Ratio: Market value to Book value";
{txt}
{com}. label var _ret          "Future: Return (US$, continuously compounded)";
{txt}
{com}. label define type_label
>         1 "Short-term debt"
>         2 "Long-term debt"
>         3 "Equity";
{txt}
{com}. label val type type_label;
{txt}
{com}. /* Save data */
> 
> sort year country type;
{txt}
{com}. save Data1, replace;
{txt}{p 0 4 2}
file {bf}
Data1.dta{rm}
saved
{p_end}

{com}. log close;
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\myogo\Princeton Dropbox\Motohiro Yogo\Koijen Yogo - International\JPE\Replication\Code\1 Data\Data1.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}31 Oct 2025, 09:17:32
{txt}{.-}
{smcl}
{txt}{sf}{ul off}